package com.santu.edu.supporter.biz.buildings.pojo.dto;

import com.santu.edu.supporter.biz.buildings.pojo.enums.BuildingsType;
import com.santu.edu.supporter.biz.buildings.pojo.po.BuildingsPO;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author luoyaoqi
 * @createTime 2024/2/20
 * @description
 */
@Data
@Accessors(chain = true)
public class BuildingsDTO {

    /**
     * 学校id
     */
    private String schoolId;

    /**
     * 楼栋id
     */
    private String buildingsId;

    /**
     * 楼栋地址
     */
    private String buildingsName;

    /**
     * 楼栋类型
     */
    private BuildingsType type;

    public static BuildingsDTO createItem(String buildingsId,String buildingsInfo,BuildingsType type,String schoolId) {
        return new BuildingsDTO()
                .setSchoolId(schoolId)
                .setBuildingsId(buildingsId)
                .setBuildingsName(buildingsInfo)
                .setType(type);
    }

    public static BuildingsDTO createItem(BuildingsPO item) {
        return new BuildingsDTO()
                .setSchoolId(item.getSchoolId())
                .setBuildingsId(item.getBuildingsId())
                .setBuildingsName(item.getBuildingsName())
                .setType(BuildingsType.convert(item.getType()));
    }
}
